package cn.z2huo.demo.activiti.service.impl;

import cn.z2huo.demo.activiti.enums.BpmProcessEnum;
import lombok.extern.slf4j.Slf4j;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
import org.activiti.engine.runtime.ProcessInstance;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class ActivitiServiceImpl {

    @Autowired
    private RuntimeService runtimeService;

    @Autowired
    private TaskService taskService;

//    @Override
    public ProcessInstance startProcess(BpmProcessEnum processEnum, String businessKey) {
        ProcessInstance processInstance = runtimeService.startProcessInstanceById(processEnum.getProcessId(), businessKey);
        log.info("开启流程成功，processDefinitionId = {}, businessKey = {}", processEnum.getProcessId(), businessKey);
        return processInstance;
    }

}
